<?php

namespace app\admin\controller;
class Loginlog extends base
{

    //前置方法
    protected $beforeActionList = [
        'map'  =>  ['only'=>'index'],
    ];

    /**
     * 搜索
     */
    protected function map(){
        if ($this->request->isGet()) {
            $data = $this->request->param();

            $this->datas = array();
            if (!empty($data['start_time']) && !empty($data['end_time']) && (strtotime($data['start_time']) < strtotime($data['end_time']))) {
                $this->datas ['create_time'] = [
                    ['>', strtotime($data['start_time'])],
                    ['<', strtotime($data['end_time'])]
                ];
            }
            if (isset($data['uid']) && !empty($data['uid'])) {
                $this->datas ['uid'] = $data['uid'];
            }
            if (isset($data['name']) && !empty($data['name'])) {
                $this->datas ['name'] = $data['name'];
            }
            if (isset($data['login_ip']) && !empty($data['login_ip'])) {
                $this->datas ['login_ip'] = $data['login_ip'];
            }
            if (isset($data['login_location']) && !empty($data['login_location'])) {
                $this->datas ['login_location']  = ['like', '%' . $data['login_location'] . '%'];
            }

        }
    }

}
